import render_helper from "./render_helper.mjs";

export default function textarea_template(container, template) {
  let textarea = document.createElement("textarea");
  textarea.name = template.textarea;
  textarea.id = template.textarea;
  container.appendChild(textarea);

  let required;

  if (template.required === false) {
    required = {};
  } else if (container.closest("formview")?.thin_allrequired === true) {
    required = { required: true };
  }

  template.a = { ...template.a, ...required };

  render_helper(textarea, template);
}
